Repository navigation
refactor(broker): rewire gate-egress/gate-fs onto canonical exec-broker decisions (reconciliation R3) - #310
Merged
Conversation
…er decisions (reconciliation R3) The PreToolUse gates now use the ONE canonical decision core instead of the duplicate: - signed source: profileBrokerPolicy (exec-broker/profile-policy) → BrokerPolicy (R2 bridge); - egress: decisions.checkEgress (stronger host parser) per host; - fs: decisions.checkFsWrite across policyFsRoots (resolve the hook path against cwd first). Fail-closed semantics preserved exactly: a wired gate with no VERIFIED scope (policy null) grants nothing. Removes the gates' dependency on src/broker/decide.ts + src/broker/scope.ts — those now have only broker/needs.ts as a consumer, deleted next in R4. Behavior unchanged: all 9 subprocess gate tests (real CLI, hook payload on stdin) still pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DbF4MFePXWNCd4dxBQvqH2
|
✅ Docker image built successfully
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Reconciliation R3 (design:
kit-research/docs/research/pillar3-broker-reconciliation-5.0.md) — the dedup win. The PreToolUse gates now use the one canonical exec-broker decision core instead of my parallel one.Type of Change
Related Issues
Changes Made
src/commands/gate.ts—cmdGateEgress/cmdGateFsnow consult:profileBrokerPolicy(R2 bridge) →BrokerPolicy,decisions.checkEgress(the stronger host parser) per host,decisions.checkFsWriteacrosspolicyFsRoots(resolving the hook path against cwd first),instead of
src/broker/decide.ts(brokerScope) +src/broker/scope.ts(hostInScope/pathInScope).null) grants nothing.Testing
Test Coverage
npm test) — full suite 2719 pass / 0 fail (no net change; a rewire)Manual Testing
npx tsc --noEmit→ clean;npx eslint src→ 0 errors.npm run build && node scripts/test.mjs→ 2719 pass, 0 fail.Breaking Changes
None / N/A — internal rewire; identical externally-observable gate behavior.
Checklist
npm test)Performance Impact
Reviewer Notes
After this,
src/broker/decide.ts+src/broker/scope.tshave onlysrc/broker/needs.tsleft as a consumer — R4 removesneeds.ts(routingwithGovernancescope via the existingrunGovernedBrokered/BrokerContext) and deletes the duplicate core, leaving one broker:src/exec-broker/*(canonical decisions + signedprofile-policyprovider), with the gates +kit doctor+ host-extractor as the net-new surfaces on top. The one behavioral nuance to check: the fs gate now resolves the hook'sfilePathagainst the agent cwd before the containment check (previously done insidepathInScope), so absolute and cwd-relative paths are handled identically — covered by the traversal-escape subprocess test.🤖 Generated with Claude Code
https://claude.ai/code/session_01DbF4MFePXWNCd4dxBQvqH2
Generated by Claude Code